//
//  ViewController.m
//  Image
//
//  Created by kang on 2018/7/11.
//  Copyright © 2018年 fuyunhe. All rights reserved.
//

#import "ViewController.h"
#import "UIImage+ImageRotate.h"
#import "UIImage+ImageCut.h"
#import "UIImage+ImageCircle.h"
#import "UIImage+ImageScale.h"
#import "UIView+ImageScreenShot.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    [self testImageScreenShot];
}

-(void)testImageRotate{
    
    UIImage *img = [UIImage imageNamed:@"1"];
    
    UIImage *imgNew = [img imageRotateIndegree:45.*0.017];
    
    UIImageWriteToSavedPhotosAlbum(imgNew, nil, nil, nil);
    
}

-(void)testImageCut{
    
    UIImage *img = [UIImage imageNamed:@"1"];
    
    UIImage *imgNew = [img imageCutSize:CGRectMake(100, 100, 500, 500)];
    
    UIImageWriteToSavedPhotosAlbum(imgNew, nil, nil, nil);
    
}

-(void)testImageCircle{
    
    UIImage *img = [UIImage imageNamed:@"1"];
    
    UIImage *imgNew = [img imageClipCircle];
    
    UIImageWriteToSavedPhotosAlbum(imgNew, nil, nil, nil);
    
}



-(void)testImageScale{
    
    UIImage *img = [UIImage imageNamed:@"1"];
    
    UIImage *imgNew = [img imageScaleSize:CGSizeMake(200, 300)];
    
    UIImageWriteToSavedPhotosAlbum(imgNew, nil, nil, nil);
    
}

-(void)testImageScreenShot{
    
    // UIImage *img = [UIImage imageNamed:@"1"];
    
    UIImage *imgNew = [self.view imageScreenShot];
    
    UIImageWriteToSavedPhotosAlbum(imgNew, nil, nil, nil);
    
}

@end
